// import * as Cesium from "cesium";

var __getOwnPropNames = Object.getOwnPropertyNames;
var __esm = (fn, res) =>
  function __init() {
    return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])((fn = 0))), res;
  };
function getLib(name) {
  return cache[name];
}
var cache;
var init_lib_utils = __esm({
  "src/global-api/lib-utils.js"() {
    cache = {};
  },
});
var Cesium, turf, echarts, Supercluster;
var init_namespace = __esm({
  "src/namespace/index.js"() {
    init_lib_utils();
    Cesium = getLib("Cesium");
    turf = getLib("turf");
    echarts = getLib("echarts");
    Supercluster = getLib("Supercluster");
  },
});

var CircleBlurMaterial_default;
var init_CircleBlurMaterial = __esm({
  "src/modules/material/shader/circle/CircleBlurMaterial.glsl"() {
    CircleBlurMaterial_default =
      "uniform vec4 color;\nuniform float speed;\nczm_material czm_getMaterial(czm_materialInput materialInput){\n  czm_material material = czm_getDefaultMaterial(materialInput);\n  vec2 st = materialInput.st ;\n  vec2 center = vec2(0.5);\n  float time = fract(czm_frameNumber * speed / 1000.0);\n  float r = 0.5 + sin(time) / 3.0;\n  float dis = distance(st, center);\n  float a = 0.0;\n  if(dis < r) {\n    a = 1.0 - smoothstep(0.0, r, dis);\n  }\n  material.alpha = pow(a,10.0) ;\n  material.diffuse = color.rgb * a * 3.0;\n  return material;\n}\n";
  },
});

// src/modules/material/shader/circle/CircleDiffuseMaterial.glsl
var CircleDiffuseMaterial_default;
var init_CircleDiffuseMaterial = __esm({
  "src/modules/material/shader/circle/CircleDiffuseMaterial.glsl"() {
    CircleDiffuseMaterial_default =
      "uniform vec4 color;\nuniform float speed;\n\nvec3 circlePing(float r, float innerTail,  float frontierBorder, float timeResetSeconds,  float radarPingSpeed,  float fadeDistance){\n  float t = fract(czm_frameNumber * speed / 1000.0);\n  float time = mod(t, timeResetSeconds) * radarPingSpeed;\n  float circle;\n  circle += smoothstep(time - innerTail, time, r) * smoothstep(time + frontierBorder,time, r);\n  circle *= smoothstep(fadeDistance, 0.0, r);\n  return vec3(circle);\n}\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\n  czm_material material = czm_getDefaultMaterial(materialInput);\n  vec2 st = materialInput.st * 2.0  - 1.0 ;\n  vec2 center = vec2(0.);\n  float time = fract(czm_frameNumber * speed / 1000.0);\n  vec3 flagColor;\n  float r = length(st - center) / 4.;\n  flagColor += circlePing(r, 0.25, 0.025, 4.0, 0.3, 1.0) * color.rgb;\n  material.alpha = length(flagColor);\n  material.diffuse = flagColor.rgb;\n  return material;\n}\n";
  },
});

// src/modules/material/shader/circle/CircleFadeMaterial.glsl
var CircleFadeMaterial_default;
var init_CircleFadeMaterial = __esm({
  "src/modules/material/shader/circle/CircleFadeMaterial.glsl"() {
    CircleFadeMaterial_default =
      "uniform vec4 color;\nuniform float speed;\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\n  czm_material material = czm_getDefaultMaterial(materialInput);\n  material.diffuse = 1.5 * color.rgb;\n  vec2 st = materialInput.st;\n  float dis = distance(st, vec2(0.5, 0.5));\n  float per = fract(czm_frameNumber * speed / 1000.0);\n  if(dis > per * 0.5){\n    material.alpha = color.a;\n  }else {\n    discard;\n  }\n  return material;\n}\n";
  },
});

// src/modules/material/shader/circle/CirclePulseMaterial.glsl
var CirclePulseMaterial_default;
var init_CirclePulseMaterial = __esm({
  "src/modules/material/shader/circle/CirclePulseMaterial.glsl"() {
    CirclePulseMaterial_default =
      "uniform vec4 color;\nuniform float speed;\nczm_material czm_getMaterial(czm_materialInput materialInput){\n  czm_material material = czm_getDefaultMaterial(materialInput);\n  vec2 st = materialInput.st * 2.0 - 1.0;\n  float time = fract(czm_frameNumber * speed / 1000.0);\n  float r = length(st) * 1.2;\n  float a = pow(r, 2.0);\n  float b = sin(r * 0.8 - 1.6);\n  float c = sin(r - 0.010);\n  float s = sin(a - time * 2.0 + b) * c;\n  float d = abs(1.0 / (s * 10.8)) - 0.01;\n  material.alpha = pow(d,10.0) ;\n  material.diffuse = color.rgb * d;\n  return material;\n}\n";
  },
});

// src/modules/material/shader/circle/CircleRingMaterial.glsl
var CircleRingMaterial_default;
var init_CircleRingMaterial = __esm({
  "src/modules/material/shader/circle/CircleRingMaterial.glsl"() {
    CircleRingMaterial_default =
      "uniform vec4 color;\nczm_material czm_getMaterial(czm_materialInput materialInput){\n  czm_material material = czm_getDefaultMaterial(materialInput);\n  vec2 st = materialInput.st;\n  vec2 center = st - vec2(0.5,0.5);\n  float length = length(center) / 0.5;\n  float time = 1. - abs(czm_frameNumber / 360. - 0.5);\n  float param = 1. - step(length, 0.6); //\u5927\u4E8E0.6\u6A21\u7CCA\uFF0Crate = 0.6\n  float scale = param * length; // 0.6< length \u8FD4\u56DE0\uFF0C\u53CD\u4E4B\u8FD4\u56DE1.\n  float alpha = param * (1.0 - abs(scale - 0.8) / 0.2); // 0.8 < length \u8FD4\u56DE0\uFF0C\u53CD\u4E4B\u8FD4\u56DE1.\n  float param1 = step(length, 0.7); //\u5C0F\u4E8E0.5\u6A21\u7CCA\n  float scale1 = param1 * length; // 0.6< length \u8FD4\u56DE0\uFF0C\u53CD\u4E4B\u8FD4\u56DE1.\n  alpha += param1 * (1.0 - abs(scale1 - 0.35) / 0.35); // 0.8 < length \u8FD4\u56DE0\uFF0C\u53CD\u4E4B\u8FD4\u56DE1.\n  material.diffuse = color.rgb * vec3(color.a);\n  material.alpha = pow(alpha, 4.0);\n  return material;\n}\n";
  },
});

// src/modules/material/shader/circle/CircleRotateMaterial.glsl
var CircleRotateMaterial_default;
var init_CircleRotateMaterial = __esm({
  "src/modules/material/shader/circle/CircleRotateMaterial.glsl"() {
    CircleRotateMaterial_default =
      "uniform vec4 color;\nuniform sampler2D image;\nczm_material czm_getMaterial(czm_materialInput materialInput){\n  czm_material material = czm_getDefaultMaterial(materialInput);\n  vec2 st = materialInput.st;\n  vec2 center = st - vec2(0.5,0.5);\n  float time = -czm_frameNumber * 3.1415926 / 180.;\n  float sin_t = sin(time);\n  float cos_t = cos(time);\n  vec2 center_rotate = vec2(center.s * cos_t - center.t * sin_t + 0.5,center.s * sin_t + center.t * cos_t + 0.5);\n  vec4 colorImage = texture(image,center_rotate);\n  vec3 temp = colorImage.rgb * color.rgb;\n  temp *= color.a;\n  material.diffuse = temp;\n  float length = 2. - length(center) / 0.5;\n  material.alpha = colorImage.a * pow(length, 0.5);\n  return material;\n}\n";
  },
});

// src/modules/material/shader/circle/CircleScanMaterial.glsl
var CircleScanMaterial_default;
var init_CircleScanMaterial = __esm({
  "src/modules/material/shader/circle/CircleScanMaterial.glsl"() {
    CircleScanMaterial_default =
      "uniform vec4 color;\nuniform float speed;\n\nfloat circle(vec2 uv, float r, float blur) {\n  float d = length(uv) * 2.0;\n  float c = smoothstep(r+blur, r, d);\n  return c;\n}\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n  czm_material material = czm_getDefaultMaterial(materialInput);\n  vec2 st = materialInput.st - .5;\n  material.diffuse = color.rgb;\n  material.emission = vec3(0);\n  float t =fract(czm_frameNumber * speed / 1000.0);\n  float s = 0.3;\n  float radius1 = smoothstep(.0, s, t) * 0.5;\n  float alpha1 = circle(st, radius1, 0.01) * circle(st, radius1, -0.01);\n  float alpha2 = circle(st, radius1, 0.01 - radius1) * circle(st, radius1, 0.01);\n  float radius2 = 0.5 + smoothstep(s, 1.0, t) * 0.5;\n  float alpha3 = circle(st, radius1, radius2 + 0.01 - radius1) * circle(st, radius1, -0.01);\n  material.alpha = smoothstep(1.0, s, t) * (alpha1 + alpha2*0.1 + alpha3*0.1);\n  material.alpha *= color.a;\n  return material;\n}\n";
  },
});

// src/modules/material/shader/circle/CircleSpiralMaterial.glsl
var CircleSpiralMaterial_default;
var init_CircleSpiralMaterial = __esm({
  "src/modules/material/shader/circle/CircleSpiralMaterial.glsl"() {
    CircleSpiralMaterial_default =
      "uniform vec4 color;\nuniform float speed;\n\n#define PI 3.14159265359\n\nvec2 rotate2D (vec2 _st, float _angle) {\n  _st =  mat2(cos(_angle),-sin(_angle),  sin(_angle),cos(_angle)) * _st;\n  return _st;\n}\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\n  czm_material material = czm_getDefaultMaterial(materialInput);\n  vec2 st = materialInput.st * 2.0 - 1.0;\n  st *= 1.6;\n  float time = czm_frameNumber * speed / 1000.0;\n  float r = length(st);\n  float w = .3;\n  st = rotate2D(st,(r*PI*6.-time*2.));\n  float a = smoothstep(-w,.2,st.x) * smoothstep(w,.2,st.x);\n  float b = abs(1./(sin(pow(r,2.)*2.-time*1.3)*6.))*.4;\n  material.alpha = a * b ;\n  material.diffuse = color.rgb * a * b  * 3.0;\n  return material;\n}\n";
  },
});

// src/modules/material/shader/circle/CircleVaryMaterial.glsl
var CircleVaryMaterial_default;
var init_CircleVaryMaterial = __esm({
  "src/modules/material/shader/circle/CircleVaryMaterial.glsl"() {
    CircleVaryMaterial_default =
      "uniform vec4 color;\nuniform float speed;\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\n  czm_material material = czm_getDefaultMaterial(materialInput);\n  vec2 st = materialInput.st  * 2.0 - 1.0;\n  float time =czm_frameNumber * speed / 1000.0;\n  float radius = length(st);\n  float angle = atan(st.y/st.x);\n  float radius1 = sin(time * 2.0) + sin(40.0*angle+time)*0.01;\n  float radius2 = cos(time * 3.0);\n  vec3 fragColor = 0.2 + 0.5 * cos( time + color.rgb + vec3(0,2,4));\n  float inten1 = 1.0 - sqrt(abs(radius1 - radius));\n  float inten2 = 1.0 - sqrt(abs(radius2 - radius));\n  material.alpha = pow(inten1 + inten2 , 5.0) ;\n  material.diffuse = fragColor * (inten1 + inten2);\n  return material;\n}\n";
  },
});

// src/modules/material/shader/circle/CircleWaveMaterial.glsl
var CircleWaveMaterial_default;
var init_CircleWaveMaterial = __esm({
  "src/modules/material/shader/circle/CircleWaveMaterial.glsl"() {
    CircleWaveMaterial_default =
      "uniform vec4 color;\nuniform float speed;\nuniform float count;\nuniform float gradient;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n  czm_material material = czm_getDefaultMaterial(materialInput);\n  material.diffuse = 1.5 * color.rgb;\n  vec2 st = materialInput.st;\n  float dis = distance(st, vec2(0.5, 0.5));\n  float per = fract(czm_frameNumber * speed / 1000.0);\n  if(count == 1.0){\n    if(dis > per * 0.5){\n      discard;\n    }else {\n      material.alpha = color.a  * dis / per / 2.0;\n    }\n  } else {\n    vec3 str = materialInput.str;\n    if(abs(str.z)  > 0.001){\n      discard;\n    }\n    if(dis > 0.5){\n      discard;\n    } else {\n      float perDis = 0.5 / count;\n      float disNum;\n      float bl = 0.0;\n      for(int i = 0; i <= 999; i++){\n        if(float(i) <= count){\n          disNum = perDis * float(i) - dis + per / count;\n          if(disNum > 0.0){\n            if(disNum < perDis){\n              bl = 1.0 - disNum / perDis;\n            }\n            else if(disNum - perDis < perDis){\n              bl = 1.0 - abs(1.0 - disNum / perDis);\n            }\n            material.alpha = pow(bl,(1.0 + 10.0 * (1.0 - gradient)));\n          }\n        }\n      }\n    }\n  }\n  return material;\n}\n\n";
  },
});

var init_circle = __esm({
  "src/modules/material/type/circle.js"() {
    init_namespace();
    init_CircleBlurMaterial();
    init_CircleDiffuseMaterial();
    init_CircleFadeMaterial();
    init_CirclePulseMaterial();
    init_CircleRingMaterial();
    init_CircleRotateMaterial();
    init_CircleScanMaterial();
    init_CircleSpiralMaterial();
    init_CircleVaryMaterial();
    init_CircleWaveMaterial();
    Cesium.Material.CircleBlurType = "CircleBlur";
    Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleBlurType, {
      fabric: {
        type: Cesium.Material.CircleBlurType,
        uniforms: {
          color: new Cesium.Color(1, 0, 0, 0.7),
          speed: 3,
        },
        source: CircleBlurMaterial_default,
      },
      translucent: function (material) {
        return true;
      },
    });
    Cesium.Material.CircleDiffuseType = "CircleDiffuse";
    Cesium.Material._materialCache.addMaterial(
      Cesium.Material.CircleDiffuseType,
      {
        fabric: {
          type: Cesium.Material.CircleDiffuseType,
          uniforms: {
            color: new Cesium.Color(1, 0, 0, 0.7),
            speed: 3,
          },
          source: CircleDiffuseMaterial_default,
        },
        translucent: function (material) {
          return true;
        },
      }
    );
    Cesium.Material.CircleFadeType = "CircleFade";
    Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleFadeType, {
      fabric: {
        type: Cesium.Material.CircleFadeType,
        uniforms: {
          color: new Cesium.Color(1, 0, 0, 0.7),
          speed: 3,
        },
        source: CircleFadeMaterial_default,
      },
      translucent: function (material) {
        return true;
      },
    });
    Cesium.Material.CirclePulseType = "CirclePulse";
    Cesium.Material._materialCache.addMaterial(
      Cesium.Material.CirclePulseType,
      {
        fabric: {
          type: Cesium.Material.CirclePulseType,
          uniforms: {
            color: new Cesium.Color(1, 0, 0, 0.7),
            speed: 12,
          },
          source: CirclePulseMaterial_default,
        },
        translucent: function (material) {
          return true;
        },
      }
    );
    Cesium.Material.CircleRingType = "CircleRing";
    Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleRingType, {
      fabric: {
        type: Cesium.Material.CircleRingType,
        uniforms: {
          color: new Cesium.Color(1, 0, 0, 0.7),
        },
        source: CircleRingMaterial_default,
      },
      translucent: function (material) {
        return true;
      },
    });
    Cesium.Material.CircleRotateType = "CircleRotate";
    Cesium.Material._materialCache.addMaterial(
      Cesium.Material.CircleRotateType,
      {
        fabric: {
          type: Cesium.Material.CircleRotateType,
          uniforms: {
            color: new Cesium.Color(1, 0, 0, 0.7),
            image: Cesium.Material.DefaultImageId,
          },
          source: CircleRotateMaterial_default,
        },
        translucent: function (material) {
          return true;
        },
      }
    );
    Cesium.Material.CircleScanType = "CircleScan";
    Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleScanType, {
      fabric: {
        type: Cesium.Material.CircleScanType,
        uniforms: {
          color: new Cesium.Color(1, 0, 0, 0.7),
          speed: 1,
        },
        source: CircleScanMaterial_default,
      },
      translucent: function (material) {
        return true;
      },
    });
    Cesium.Material.CircleSpiralType = "CircleSpiral";
    Cesium.Material._materialCache.addMaterial(
      Cesium.Material.CircleSpiralType,
      {
        fabric: {
          type: Cesium.Material.CircleSpiralType,
          uniforms: {
            color: new Cesium.Color(1, 0, 0, 0.7),
            speed: 3,
          },
          source: CircleSpiralMaterial_default,
        },
        translucent: function (material) {
          return true;
        },
      }
    );
    Cesium.Material.CircleVaryType = "CircleVary";
    Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleVaryType, {
      fabric: {
        type: Cesium.Material.CircleVaryType,
        uniforms: {
          color: new Cesium.Color(1, 0, 0, 0.7),
          speed: 3,
        },
        source: CircleVaryMaterial_default,
      },
      translucent: function (material) {
        return true;
      },
    });
    Cesium.Material.CircleWaveType = "CircleWave";
    Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleWaveType, {
      fabric: {
        type: Cesium.Material.CircleWaveType,
        uniforms: {
          color: new Cesium.Color(1, 0, 0, 0.7),
          speed: 3,
          count: 1,
          gradient: 0.1,
        },
        source: CircleWaveMaterial_default,
      },
      translucent: function (material) {
        return true;
      },
    });
  },
});
